class MyQueue {
public:
    stack<int> in;
    stack<int> out;
    MyQueue() {
        // 栈是后入先出 队列是先入先出 那么用两个栈实现队列
        //
    }
    void out2(stack<int>& in, stack<int>& out) {
        while (in.size() > 0) {
            int a = in.top();
            in.pop();
            out.push(a);
        }
    }
    void push(int x) { this->in.push(x); }

    int pop() {
        if(out.size() == 0)
        out2(this->in, this->out);
        int a = this->out.top();
        this->out.pop();
        return a;
    }

    int peek() {
        if(out.size() == 0)
        out2(this->in, this->out);
        int a = this->out.top();
        return a;
    }

    bool empty() {
        if (this->out.size() > 0 || this->in.size() > 0)
            return false;
        else return true;
    }
};

/**
 * Your MyQueue object will be instantiated and called as such:
 * MyQueue* obj = new MyQueue();
 * obj->push(x);
 * int param_2 = obj->pop();
 * int param_3 = obj->peek();
 * bool param_4 = obj->empty();
 */
